package com.crois.barrier.admin.controller;


import com.crois.barrier.admin.entity.StatisticsSend;
import com.crois.barrier.admin.mapstruct.StatisticsSendDtoEntityMapper;
import com.crois.barrier.admin.resp.BarrierResponseWrapper;
import com.crois.barrier.admin.service.IStatisticsSendSvc;
import com.crois.barrier.common.response.BarrierResponseEntity;
import com.crois.barrier.common.utils.UtilsAndCommons;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 15:41 2021/10/27
 */
@RequestMapping(UtilsAndCommons.DEFAULT_BARRIER_ADMIN_STATISTICS_SEND_CONTEXT)
@RestController
public class StatisticsSendCtl {

    @Autowired
    @Qualifier("statisticsSendSvc")
    private IStatisticsSendSvc statisticsSendSvc;

    /***
     * barrier statistics send list
     */
    @GetMapping(UtilsAndCommons.BARRIER_LIST_CONTEXT)
    public BarrierResponseEntity<List<?>> statisticsSendList(){
        List<StatisticsSend> statisticsSends = statisticsSendSvc.findStatisticsSendList();
        return BarrierResponseWrapper.okList(StatisticsSendDtoEntityMapper.INSTANCE.toStatisticsSendDtoList(statisticsSends));
    }

}
